home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BCI NET
/
BCI NET Dec 94.iso
/
archives
/
programming
/
source
/
retinasource.lha
/
RBO_SCode.lha
/
Include
/
LineDraw.i
< prev
next >
Wrap
Text File
|
1993-05-03
|
2KB
|
114 lines
* This the Amiga System Programmers Guild, Line Draw routine.
Dmaconr equ $002
Bltbmod equ $062
Bltapth equ $050
Bltamod equ $064
Bltcon0 equ $040
Bltcon1 equ $042
Bltcmod equ $060
Bltdmod equ $066
Bltadat equ $074
Bltafwm equ $044
Bltbdat equ $072
Bltcpth equ $048
Bltdpth equ $054
Bltsize equ $058
bltaptl equ $52
* * * * * * * * * *
* d0 = X1, d1= Y1, d2= X2, d3= Y2
* a0 = bitplane
* a1 = width in bytes
* a2 = word written to mask register $FFFF
* d4, d6 used.
* * * * * * * * * *
DrawLine:
move.l #$dff000,a5
move.l a1,d4
mulu d1,d4
moveq #-$10,d5
and.w d0,d5
lsr.w #3,d5
add.w d5,d4
add.l a0,d4
clr.l d5
sub.w d1,d3
roxl.b #1,d5
tst.w d3
bge.s y2gy1
neg.w d3
y2gy1:
sub.w d0,d2
roxl.b #1,d5
tst.w d2
bge.s x2gx1
neg.w d2
x2gx1:
move.w d3,d1
sub.w d2,d1
bge.s dygdx
exg d2,d3
dygdx:
roxl.b #1,d5
move.b Octant_table(pc,d5),d5
add.w d2,d2
WBlit: btst #14,dmaconr(a5)
bne.s WBlit
move.w d2,bltbmod(a5)
sub.w d3,d2
bge.s signn1
or.b #$40,d5
signn1: move.w d2,bltaptl(a5)
sub.w d3,d2
move.w d2,bltamod(a5)
move.w #$8000,bltadat(a5)
move.w a2,bltbdat(a5)
move.w #$ffff,bltafwm(a5)
and.w #$000f,d0
ror.w #4,d0
or.w #$0bca,d0
move.w d0,bltcon0(a5)
move.w d5,bltcon1(a5)
move.l d4,bltcpth(a5)
move.l d4,bltdpth(a5)
move.w a1,bltcmod(a5)
move.w a1,bltdmod(a5)
lsl.w #6,d3
addq.w #2,d3
move.w d3,bltsize(a5)
rts
* Normal Lines.
Octant_table:
dc.b 0*4+1
dc.b 4*4+1
dc.b 2*4+1
dc.b 5*4+1
dc.b 1*4+1
dc.b 6*4+1
dc.b 3*4+1
dc.b 7*4+1
* Lines for filling with the blitter.
; DC.B 0*4+3
; DC.B 4*4+3
; DC.B 2*4+3
; DC.B 5*4+3
; DC.B 1*4+3
; DC.B 6*4+3
; DC.B 3*4+3
; DC.B 7*4+3
* * * * * * * * * *